﻿@using Peninsula.Web.Models.RepairOrder;
@model RepairOrderCreateOrEditModel 

@{ 
	bool isEdit = Model.IsEdit;
	string title = isEdit ? "编辑" : "新建";
	var imagesName = "images";

}
@section Styles{
	@Styles.Render(BundleConfig.BootstrapUploadKrajeeCssBundle)
}

@section Scripts{
	@Scripts.Render(BundleConfig.BootstrapUploadKrajeeJsBundle)
	<script type="text/javascript">
		$(function () {
			$('#@imagesName').fileinput(@Html.Raw(Model.JQueryFileInputModel.ToJson()));
			$('#clearDateKeyWord').click(function () {
				$('#Appointment').val(""); // 清空日期
			});
			$(".form_datetime").datetimepicker({
				format: "yyyy/mm/dd hh:ii",
				language: 'zh-CN',
				autoclose: true,
				todayBtn: true,
				startDate: new Date(),//开始时间
				minuteStep: 10
			});
			//var s=startd.toTimeString();
			//alert(s);
			//$('#Appointment').val($('#Appointment').val().replace('0:00:00', ''));
			//$('#Appointment').val() = new Date().toDateString();
			@*$.recoobHelper.searchSelect2($('#@nameof(Model.UserId)'), '@FishcooV2.Site.Data.Constant.SearchType.User', '@Url.Action("SearchForSelect2", "Common")');*@
		});
	</script>
}


<div class="portlet">
	<div class="portlet-title">
		<div class="caption">
			<i class="fa fa-reorder"></i>@(title)维修订单
		</div>
	</div>
	<div class="portlet-body form">

		@using (Html.BeginForm("CreateOrEditRepairOrder", "RepairOrder", FormMethod.Post, new { @class = "form-horizontal js-form js-ajax-form" }))
		{
			@Html.AntiForgeryToken()
			@Html.HiddenFor(m => m.Id)
			@Html.HiddenFor(m => m.IsEdit)
			<div class="form-body">
				<div class="form-group">
					<label class="col-md-3 control-label">
						<span style="color:red">*</span>@Html.DisplayNameFor(m => m.ItemTypeId)
					</label>
					<div class="col-md-7">
						@Html.DropDownAllowNullListFor(m => m.ItemTypeId, Model.ItemTypes, "请选择", new { @class = "form-control select2" })
						@Html.ValidationMessageFor(m => m.ItemTypeId)
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-3 control-label">
						<span style="color:red">*</span>@Html.DisplayNameFor(m => m.Name)
					</label>
					<div class="col-md-7">
						@{ if (isEdit)
							{
							  @Model.Name
							  @Html.HiddenFor(m => m.Name)
							}
							else
							{
								@Html.TextBoxFor(m => m.Name, new { @class = "form-control" })
								@Html.ValidationMessageFor(m => m.Name)
							}
						} 
					</div>
				</div>
				<div class="form-group">
					<label class="control-label col-md-3">
						<span style="color:red">*</span>@Html.DisplayNameFor(m => m.Appointment)
					</label>
					<div class="col-md-5">
						<div class="input-group">
							@Html.TextBoxFor(m => m.Appointment, new { @class = "form-control form_datetime date", @readonly = true })
							<span class="input-group-btn">
								<button class="btn btn-success" type="button" id="clearDateKeyWord"><i class="fa fa-times"></i></button>
							</span>
						</div>
					</div>
				</div>
				<div class="form-group">
					<label class="col-md-3 control-label">
						<span style="color:red">*</span>@Html.DisplayNameFor(m => m.Description)
					</label>
					<div class="col-md-7">
						@Html.TextAreaFor(m => m.Description, new { @class = "form-control", rows = 9 })
						@Html.ValidationMessageFor(m => m.Description)
					</div>
				</div>

				<div class="form-group">
					<label class="control-label col-md-3">
						@Html.DisplayNameFor(m => m.JQueryFileInputModel)
					</label>
					<div class="col-md-7">
						<input id="@imagesName" type="file" multiple name="files" class="file-loading">
						<span class="help-block">可多选，请在文件选择时选择多张</span>
					</div>
				</div>
				
				
			</div>
			<div class="form-actions fluid">
				<div class="col-md-offset-3 col-md-9">
					<button type="submit" class="btn btn-success">保存</button>
					<a href="@HttpContext.Current.Request.UrlReferrer" class="btn btn-default">取消</a>
				</div>
			</div>
		}

	</div>
</div>